﻿@using Microsoft.Web.Helpers;

@{
     var inputFirstName = "";
     var inputLastName = "";
     var inputPracticalScore = "";
     var inputTheoreticalScore = "";
     var inputNotes = "";
     var inputTags = "";
     var inputEntryDate = "";
     var inputEntryType = "";
     var inputComments = "";
     var isDeleted = "False";
    

     var db = Database.Open("CvProjectDatabase");
     var insertQuery = "INSERT INTO Applicants (FirstName, LastName, PracticalScore, TheoreticalScore, Notes, isDeleted) VALUES (@0, @1, @2, @3, @4, @5)";

    // var insertHistory = "INSERT INTO HistoryEntry"

     if(IsPost){
         
         inputFirstName = Request.Form["FirstName"];
         inputLastName = Request.Form["LastName"];
         inputPracticalScore = Request.Form["PracticalScore"];
         inputTheoreticalScore = Request.Form["TheoreticalScore"];
         inputNotes = Request.Form["Notes"];

         db.Execute(insertQuery, inputFirstName, inputLastName, inputPracticalScore, inputTheoreticalScore, inputNotes, isDeleted);
         Response.Redirect("ApplicantsAdministration.cshtml?rezultat=Successfuly added applicant");
     }
}

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Bootstrap 101 Template</title>

    <!-- Bootstrap -->
    <link href="res/css/bootstrap.min.css" rel="stylesheet">

   

  </head>
  <body>
   

       <nav class="navbar navbar-inverse" role="navigation">
            <div class="container-fluid">
                 <ul id="navigacija" class="nav navbar-nav">
                     <li style="margin-right: 30px"><a href="Index.cshtml"><b style="font-size: 1.7em">CV Database</b></a></li>
                     <li style="font-size: 1.2em"><a href="UserAdministration.cshtml">User Administration</a></li>
                     <li style="padding-top: 15px"> | </li>
                   
                    
                        <li class="dropdown" style="font-size: 1.2em">
                        
                            
                            <li style="font-size: 1.2em"><a href="index.cshtml?izlogujSe=true">Izlogujte se</a></li>
                        </ul>
                    </li>
                    
                 </ul>
            </div>
        </nav>


      <h3>@Request.QueryString["rezultat"]</h3>

      <form method="post">
          <fieldset>
            <legend>Applicant info</legend>
            <p><label for="FirstName">First name:</label>
                <input type="text" name="FirstName" value="@Request.Form["FirstName"]"/>
            </p>
              <p><label for="LastName">Last name:</label>
                <input type="text" name="LastName" value="@Request.Form["LastName"]"/>
            </p>
              <p><label for="PracticalScore">Practical score:</label>
                <input type="text" name="PracticalScore" value="@Request.Form["PracticalScore"]"/>
            </p>
            <p><label for="TheoreticalScore">Theoretical score:</label>
                <input type="text" name="TheoreticalScore" value="@Request.Form["TheoreticalScore"]"/>
            </p>
            <p><label for="opis">Notes:</label></p>
                  <textarea name="Notes" rows="4" cols="29"  @Validation.For("Notes") >@Request.Form["Notes"]</textarea >
              
               <p><input type="submit" name="buttonSubmit" value="Save" /></p>
            
          </fieldset>
      
      </form>

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="res/js/bootstrap.min.js"></script>
  </body>
</html>
